from fastapi import FastAPI
from .sql import main_sql
from fastapi.middleware.cors import CORSMiddleware

app = FastAPI(
    title='MiniJudge迷你判题平台',
    version='0.0.1dev'
)

origin = [
    "http://localhost:8080"
]

app.add_middleware(
    CORSMiddleware,
    allow_origins = origin,
    allow_credentials=True,
    allow_methods = ['*'],
    allow_headers = ['*']
)

app.include_router(router=main_sql.router)

@app.get('/')
def test():
    return {
        'message': 'Hello World'
    }

